Merged.
authoremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>
Wed, 29 Mar 2006 17:41:30 +0000 (18:41 +0100)
committeremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>
Wed, 29 Mar 2006 17:41:30 +0000 (18:41 +0100)
linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c
xen/arch/x86/domain.c
xen/arch/x86/smpboot.c
xen/include/asm-x86/shadow.h

index 23fe51a36289c6913298b1ecef0822b244788e70..c1b63752a199492284c52d542b8091dd506e2736 100644 (file)
@@ -253,6 +253,7 @@ static void frontend_changed(struct xenbus_device *dev,
 
        switch (frontend_state) {
        case XenbusStateInitialising:
+       case XenbusStateConnected:
                break;
 
        case XenbusStateInitialised:
index b8e6ce9708601eb6a801f4e80afb250b27eaa395..0a48ba6053a593fe0534fd3cfbc9ec955eedc058 100644 (file)
@@ -226,6 +226,13 @@ struct vcpu *alloc_vcpu_struct(struct domain *d, unsigned int vcpu_id)
 
     v->arch.schedule_tail = is_idle_domain(d) ?
         continue_idle_domain : continue_nonidle_domain;
+        percpu_ctxt[vcpu_id].curr_vcpu = v;
+        v->arch.schedule_tail = continue_idle_domain;
+    }
+    else
+    {
+        v->arch.schedule_tail = continue_nonidle_domain;
+    }
 
     v->arch.ctxt_switch_from = paravirt_ctxt_switch_from;
     v->arch.ctxt_switch_to   = paravirt_ctxt_switch_to;
index 3a35ca339e9ec1866b591f6ec1791a0f692601cb..f908af1c79b31a1939d69ac27bf7381dd7638a8e 100644 (file)
@@ -881,6 +881,7 @@ static int __devinit do_boot_cpu(int apicid, int cpu)
  * Returns zero if CPU booted OK, else error code from wakeup_secondary_cpu.
  */
 {
+       struct vcpu *v;
        unsigned long boot_error;
        int timeout;
        unsigned long start_eip;
index 28d50466ea004519cdfcb2710db3af2797242419..989768daa42fc97e9f7ae61668b9c805adf1f5cd 100644 (file)
@@ -662,10 +662,14 @@ static inline void shadow_sync_and_drop_references(
     if ( likely(!shadow_mode_refcounts(d)) )
         return;
 
+    shadow_lock(d);
+
     if ( page_out_of_sync(page) )
         __shadow_sync_mfn(d, page_to_mfn(page));
 
     shadow_remove_all_access(d, page_to_mfn(page));
+
+    shadow_unlock(d);
 }
 #endif
 
@@ -699,6 +703,46 @@ get_shadow_ref(unsigned long smfn)
     return 1;
 }
 
+    shadow_sync_and_drop_references(d, mfn_to_page(mfn));
+    set_p2m_entry(d, gpfn, -1, &c1, &c2);
+    set_gpfn_from_mfn(mfn, INVALID_M2P_ENTRY);
+    shadow_unlock(d);
+    domain_mmap_cache_destroy(&c1);
+    domain_mmap_cache_destroy(&c2);
+}
+
+/************************************************************************/
+
+/*
+ * Add another shadow reference to smfn.
+ */
+static inline int
+get_shadow_ref(unsigned long smfn)
+{
+    u32 x, nx;
+
+    ASSERT(mfn_valid(smfn));
+
+    x = mfn_to_page(smfn)->count_info;
+    nx = x + 1;
+
+    if ( unlikely(nx == 0) )
+    {
+        printk("get_shadow_ref overflow, gmfn=%" PRtype_info  " smfn=%lx\n",
+               mfn_to_page(smfn)->u.inuse.type_info & PGT_mfn_mask,
+               smfn);
+        BUG();
+    }
+    
+    // Guarded by the shadow lock...
+    //
+    mfn_to_page(smfn)->count_info = nx;
+
+    return 1;
+}
+
+extern void free_shadow_page(unsigned long smfn);
+
 /*
  * Drop a shadow reference to smfn.
  */